#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main() {
    long long n, m, start, tmp, max, min, k;
    scanf("%lld %lld", &n, &m);
    start = n, tmp = m;
    while (k = n % m)
    {
        n = m;
        m = k;
    }
    max = m;
    min = (start * tmp) / max;
    printf("%lld", max + min);
    return 0;
}
